package com.csun.cmny.provider.device.phone;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.serialization.ObjectEncoder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-02-19 09:22
 * @Description: the class phone netty tcp channel handler
 */
@Component
public class PhoneNettyTcpChannelHandler extends ChannelInitializer<SocketChannel> {

    @Resource
    private PhoneNettyTcpServerHandler phoneNettyTcpServerHandler;

    public void initChannel(SocketChannel socketChannel) throws Exception {
        socketChannel.pipeline().addLast(new ObjectEncoder());
        socketChannel.pipeline().addLast(phoneNettyTcpServerHandler);
    }
}
